<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title>阿里迪里影院_后台管理</title>
	<link href="../images/favicon.ico" rel="shortcut icon" />
</head>

<link rel="stylesheet" type="text/css" href="../layui/css/layui.css" />
<link rel="stylesheet" type="text/css" href="../layui/css/global.css" />
<link rel="stylesheet" type="text/css" href="css/manage.css" />

<body class="layui-layout-body">
	<div class="layui-layout layui-layout-admin" id="manage-index">
		<div class="layui-header">
			<div class="layui-logo" style="color:white">阿里迪里影院</div>
			<!-- 头部区域（可配合layui已有的水平导航） -->

			<ul class="layui-nav layui-layout-right">
				<li class="layui-nav-item"><a href="javascript:;"><img v-bind:src="'images/'+admin.image"
							class="layui-nav-img">{{this.admin.adminName}}</a>
					<dl class="layui-nav-child">
						<dd id="n1" class="subMenu">
							<a href="javascript:;" data-url="manage-admin.html">基本资料</a>
						</dd>
						<dd style="cursor: pointer;">
							<a id="updatePass">修改密码</a>
						</dd>
					</dl>
				</li>
				<li class="layui-nav-item" @click="logout"><a href="#"><i class="layui-icon" title="退出">&#xe682;</i></a>
				</li>
			</ul>
		</div>

		<div class="layui-side layui-bg-black">
			<div class="layui-side-scroll">
				<!-- 左侧导航区域（可配合layui已有的垂直导航） -->
				<ul class="layui-nav layui-nav-tree" lay-filter="test">
					<li class="layui-nav-item"><a class="" href="javascript:;"><i
								class="sameIco layui-icon">&#xe6ed;</i>&nbsp;&nbsp;&nbsp;影厅管理</a>
						<dl class="layui-nav-child">
							<dd id="m1" class="subMenu">
								<a href="javascript:;"
									data-url="hall_list.html">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;影厅列表</a>
							</dd>

						</dl>
					</li>
					<li class="layui-nav-item"><a href="javascript:;"><i
								class="sameIco layui-icon">&#xe634;</i>&nbsp;&nbsp;&nbsp;影片管理</a>
						<dl class="layui-nav-child">
							<dd id="m2" class="subMenu">
								<a href="javascript:;"
									data-url="film_list.html">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;影片列表</a>
							</dd>

						</dl>
					</li>
					<li class="layui-nav-item"><a href="javascript:;"><i
								class="sameIco layui-icon">&#xe681;</i>&nbsp;&nbsp;&nbsp;影片上映</a>
						<dl class="layui-nav-child">
							<dd id="m3" class="subMenu">
								<a href="javascript:;"
									data-url="show_list.html">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;放映计划</a>
							</dd>

						</dl>
					</li>
					<li class="layui-nav-item"><a href="javascript:;"><i
								class="sameIco layui-icon">&#xe770;</i>&nbsp;&nbsp;&nbsp;会员管理</a>
						<dl class="layui-nav-child">
							<dd id="m4" class="subMenu">
								<a href="javascript:;"
									data-url="user_list.html">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;查看会员</a>
							</dd>

						</dl>
					</li>
					<li class="layui-nav-item"><a href="javascript:;"><i
								class="sameIco layui-icon">&#xe674;</i>&nbsp;&nbsp;&nbsp;系统统计</a>
						<dl class="layui-nav-child">
							<dd id="m5" class="subMenu">
								<a href="javascript:;"
									data-url="admin_list.html">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;票房统计</a>
							</dd>
							<dd id="m6" class="subMenu">
								<a href="javascript:;"
									data-url="order_list.html">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;订单列表</a>
							</dd>

						</dl>
					</li>
				</ul>
			</div>
		</div>


		<!-- 选项卡 -->
		<div class="layui-tab layui-tab-brief" lay-filter="demo" lay-allowclose="true">

			<!-- 选项卡标题 -->
			<ul class="layui-tab-title site-demo-title">

				<li id="homeTab" class="layui-this" lay-id="1">首页</li>
			</ul>

			<!-- 选项卡内容 -->
			<div class="layui-body layui-tab-content site-demo site-demo-body" style="overflow: hidden;">
				<div class="layui-tab-item layui-show" style="overflow-y: auto;">

					<!-- 浮动框架 -->
					<iframe src="manage_main.html" class="layadmin-iframe" frameborder="no" border="0"
						allowtransparency="yes"></iframe>
				</div>
			</div>
		</div>


		<!-- 跑马灯 -->
		<div class="layui-footer">
			<!-- 底部固定区域 -->
			<div style="height:100%;width:100%;overflow: hidden;margin-left:0">
				<marquee direction="left" behavior="scroll" scrollamount="9" scrolldelay="100">
					阿里迪里影院售票管理系统创建于2020年8月，是一个对影院票务数据和影院票务管理系统进行管理的软件平台，旨在方便顾客购票，帮助售票人员提高工作效率，使杂乱的影院售票数据能够具体化、直观化、合理化等。同时我们也将不断进行技术革新和产品升级，只为给大家带来更好的体验，感谢支持！
					---阿里迪里影院团队
				</marquee>
			</div>
		</div>

		<!-- 修改密码弹出层 -->
		<form class="layui-form" style="display: none;margin: 20px;" id="updatePassOpen">
			<div class="layui-form-item">
				<div class="layui-input-inline">
					<input type="password" id="oldPass" placeholder="请输入旧密码" class="layui-input">
				</div>
			</div>

			<div class="layui-form-item">
				<div class="layui-input-inline">
					<input type="password" id="newPass" placeholder="请输入新密码" class="layui-input">
				</div>
			</div>
		</form>
	</div>

	<script src="../js/jquery-1.12.4.min.js"></script>
	<script src="../js/Vue.js"></script>
	<script src="../layui/layui.js"></script>
	<script src="js/manage-index.js"></script>
	<script>
		//弹出一个页面层（用户修改密码）  
		$('#updatePass').on('click', function () {
			layer.open({
				type: 1,
				skin: 'layui-layer-molv',
				title: '修改密码',
				anim: 1,   // 动画
				resize: false,  // 是否允许拉伸改变宽高
				area: ['230px', '230px'], // 设置宽，高
				shadeClose: false, //点击遮罩关闭
				content: $("#updatePassOpen"),
				btn: ['确认', '取消'],
				btn1: function (index) {
					let oldPass = $("#oldPass");
					let newPass = $("#newPass");
					if (oldPass.val() == "") {
						oldPass.focus();
						layer.msg("请输入旧密码", { offset: 't', icon: 5, anim: 6 });
						return;
					}
					if (newPass.val() == "") {
						newPass.focus();
						layer.msg("请输入新密码", { offset: 't', icon: 5, anim: 6 });
						return;
					}
					let ad=JSON.parse(sessionStorage.getItem("admin"));
					let formData = {
						adminId: ad.adminId,
						rightPass: ad.password,
						oldPass: oldPass.val(),
						newPass: newPass.val()
					}

					$.ajax({
						url: 'http://localhost:8080/cinema/api/AdminUpdatePassServlet.do',
						type: 'put',
						dataType: 'json',
						data: JSON.stringify(formData),     // 把JavaScript对象，转换为JSON字符串
						success: function (dto) {
							if (dto.code == 200) {
								// 重新设置会话存储数据
								let admin = {
									adminId: ad.adminId,
									adminName: ad.adminName,
									password: newPass.val(),
									level: ad.level,
									image: ad.image,
									registerTime: ad.registerTime,
									status: ad.status
								}
								sessionStorage.setItem('admin', JSON.stringify(admin));

								oldPass.val("");
								newPass.val("");
								// 关闭弹出层
								layer.close(index);
								layer.msg(dto.value, { icon: 1 });

							} else {
								oldPass.focus();
								layer.msg(dto.msg, { offset: 't', icon: 5, anim: 6 });
							}
						}
					});
				},
				btn2: function () {
					$("#oldPass").val('');
					$("#newPass").val('');
				}
			});
		});
	</script>
</body>

</html>